
package jz.olap.ds;

public class unit {

	public static double toDouble(Object cellvalue) {
		double value = 0.0;
		if (cellvalue instanceof Double) {
			value = ((Double) cellvalue).doubleValue();
		} else if (cellvalue instanceof Float) {
			value = ((Float) cellvalue).doubleValue();
		} else if (cellvalue instanceof Integer) {
			value = ((Integer) cellvalue).doubleValue();
		} else if (cellvalue instanceof Long) {
			value = ((Long) cellvalue).doubleValue();
		} else if (cellvalue instanceof Short) {
			value = ((Short) cellvalue).doubleValue();
		}
		if (Double.isInfinite(value)) {
			value = 0.0;
		} else if (Double.isNaN(value)) {
			value = 0.0;
		}
		return value;
	}
}
